Android 触摸事件分发流程 发表于 2017-09-23 | 分类于 编程 , android , android sdk , touch event 需要整理12345678910111213141516171819202122232425private boolean clickOutsideOf(View v, MotionEvent ev) { if (v.isShown()) { Rect rect = new Rect(); v.getGlobalVisibleRect(rect); if (!rect.contains((int) ev.getRawX(), (int) ev.getRawY())) { return true; } } return false;} @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { if (clickOutsideOf(filterListScrollView, ev)) { mFilterSelectedPresenter.handlerFilterContainer(); return true; } else if (clickOutsideOf(effectListRecyclerView, ev)) { viewModel.setEffectVideoMode(false); return true; } } return super.dispatchTouchEvent(ev); }